<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\bootstrap\Modal;

/* @var $this  yii\web\View */
/* @var $model \yii2mod\rbac\models\BizRuleModel */

$this->title = Yii::t('region', 'Create RegionType');
//$this->params['breadcrumbs'][] = ['label' => Yii::t('yii2mod.rbac', 'Rules'), 'url' => ['index']];
//$this->params['breadcrumbs'][] = $this->title;
//$this->render('/layouts/_sidebar');
?>
<div class="rule-item-create" style="min-height: 1126px;">

    <section class="content-header">

    <h1><?php echo Html::encode('查看' . $prodSpecName . '信息'); ?><small>详细资料</small></h1>
        <ol class="breadcrumb">
            <?php
            echo Html::a(Yii::t('region', 'Back')   , Yii::$app->request->getReferrer() , ['class' => 'btn btn-block btn-success btn-sm']);
            ?>
        </ol>
    </section>


    <section class="content">


        <div class="row">

            <div class="col-md-12">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">

                        <li class="active"><a href="#activity" data-toggle="tab" aria-expanded="true">客户详情</a></li>
                        <li class=""><a href="#timeline" data-toggle="tab" aria-expanded="false" class="tborder-log-tabs" data-cust-id="<?= $model->id ?>"  data-order-id="<?= $order_id ?>">跟进记录</a></li>

                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active" id="activity">

                            <?php
                                echo $this->render('cust_info',
                                ['model' => $model,
                                  'orderModel' => $orderModel,
                                'p1' =>$p1,
                                'attrSpecNames' => $attrSpecNames,
                                    'attrOrderSpecNames' => $attrOrderSpecNames,
                                'topShows' => $topShows,
                                'attr_type_spec_id' =>$attr_type_spec_id,
                                'attrSpecs' => $attrSpecs,
                                'regionList' =>$regionList,
                                'prodSpecName' =>$prodSpecName,
                                'update'=>1]);
                            ?>



                        </div>
                        <div class="tab-pane" id="timeline">

                            <!-- The timeline -->
                            <ul class="timeline timeline-inverse">
                                <!-- timeline time label -->

                            </ul>
                        </div>
                        <div style="display: none; position: absolute; top: 60px;right: 50px;" id="btn">
                            <?= Html::a( '进度更新', '#', ['id' => 'activity-handling-resumes-link',
                                'class' => "activity-handling-resumes-link  btn btn-block btn-success btn-sm",
                                'data-toggle'=>'modal',
                                'data-target'=>'#handling-resumes-modal',
                                'label'=>'更新进度', 'title' => '更新进度',
                                'data-order-id'=>$_GET['order_id'],
                                'data-last_url' =>Yii::$app->request->getUrl()]);?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>

<?php //$('.document-tborder-log').remove();
if($_GET['timeline']=='timeline'){
$js = <<<JS
$(function(){
    $('.tborder-log-tabs').trigger("click");//默认点击事件
});
JS;
$this->registerJs($js);
};



$js = <<<JS
jQuery('.tborder-log-tabs').on('click',function() {


$.get(
'/prod/order/prodorder',
{
object_id: $(this).data('cust-id'),
order_id: $(this).data('order-id')
},
function (data) {
$('#timeline').html(data);
$("#btn").show();
}
);
});

JS;
$this->registerJs($js);




//跟新进度
$js = <<<JS
jQuery('.activity-handling-resumes-link').on('click',function() {
    $('.document-handling-resumes-form').remove();
    $.get(
        '/prod/order/handling',
        {
            order_id: $(this).data('order-id') ,
             last_url: $(this).data('last_url')
        },
        function (data) {
            $('.modal-dialog').html(data);
            $('#handling-resumes-modal').modal();
        }
    );
});
JS;
$this->registerJs($js);


Modal::begin([
    'id' => 'handling-resumes-modal',
    'class' => 'modal modal-primary',
    'header' => '<h4 class="modal-title">更新订单状态</h4>',
    'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
    'options' => [
        'tabindex' => false
    ],
]);
Modal::end();

?>